const utils = {
    isObj(obj){
        return Object.prototype.toString.call(obj).slice(8,-1) === 'Object';
    },

    isArr(obj){
        return Object.prototype.toString.call(obj).slice(8,-1) === 'Array';
    },

    genID (length = 32){
        return Number(Math.random().toString().substr(3,length) + Date.now()).toString(36);
    },

    url2params(url){
        if(!url) return {};
        let pstr = url.split('?')[1];
        let obj = {};
         pstr.split('&').forEach(item => {
            let temp = item.split('=');
            return Object.assign(obj, {
                [temp[0]] : temp[1]
            })
        })

        return obj;
    },

}

export default utils